#
#  SSF.OS.OSPF validation test Makefile
#

SHELL = /bin/sh


#----------------------------------------------------------- SETUP

TOPDIR = ../../../../..
include $(TOPDIR)/Makefile.common

JAVAC = javac -classpath $(SSFNET_TEST_CLASSPATH)
JAVA  = java  -classpath $(SSFNET_TEST_CLASSPATH)

#----------------------------------------------------------- MAKE TESTS

tests:
	(cd routertype1;   $(MAKE))
	(cd interfaces1;   $(MAKE))
	(cd lsdb1;         $(MAKE))
	(cd fwdtable1;     $(MAKE))
	(cd routertype2;   $(MAKE))
	(cd interfaces2;   $(MAKE))
	(cd lsdb2;         $(MAKE))
	(cd fwdtable2;     $(MAKE))
	@echo '-------- SSF.OS.OSPF testing complete --------'
	@echo ''

#----------------------------------------------------------- MAKE VALID

# same as 'make tests' but less verbose

valid:
	@echo ''
	@echo '*** Validating SSF.OS.OSPF ***'
	@echo ''
	@echo -n 'running routertype1 validation test ... '
	@(cd routertype1; $(MAKE) valid) > /dev/null 2>&1
	@echo 'success.'
	@echo -n 'running interfaces1 validation test ... '
	@(cd interfaces1; $(MAKE) valid) > /dev/null 2>&1
	@echo 'success.'
	@echo -n 'running lsdb1 validation test ...       '
	@(cd lsdb1; $(MAKE) valid) > /dev/null 2>&1
	@echo 'success.'
	@echo -n 'running fwdtable1 validation test ...   '
	@(cd fwdtable1; $(MAKE) valid) > /dev/null 2>&1
	@echo 'success.'
	@echo -n 'running routertype2 validation test ... '
	@(cd routertype2; $(MAKE) valid) > /dev/null 2>&1
	@echo 'success.'
	@echo -n 'running interfaces2 validation test ... '
	@(cd interfaces2; $(MAKE) valid) > /dev/null 2>&1
	@echo 'success.'
	@echo -n 'running lsdb2 validation test ...       '
	@(cd lsdb2; $(MAKE) valid) > /dev/null 2>&1
	@echo 'success.'
	@echo -n 'running fwdtable2 validation test ...   '
	@(cd fwdtable2; $(MAKE) valid) > /dev/null 2>&1
	@echo 'success.'
	@echo ''
	@echo '------- SSF.OS.OSPF validation tests successful --------'
	@echo ''

#----------------------------------------------------------- MAKE CLEAN

clean:
	@(cd routertype1;   $(MAKE) clean) > /dev/null 2>&1
	@(cd interfaces1;   $(MAKE) clean) > /dev/null 2>&1
	@(cd lsdb1;         $(MAKE) clean) > /dev/null 2>&1
	@(cd fwdtable1;     $(MAKE) clean) > /dev/null 2>&1
	@(cd routertype2;   $(MAKE) clean) > /dev/null 2>&1
	@(cd interfaces2;   $(MAKE) clean) > /dev/null 2>&1
	@(cd lsdb2;         $(MAKE) clean) > /dev/null 2>&1
	@(cd fwdtable2;     $(MAKE) clean) > /dev/null 2>&1

#----------------------------------------------------------- MAKE SPOTLESS

spotless: clean
	@find . \( -name "*.class" -o -name ".*~" -o -name "*~" \) -exec rm -f {} \; > /dev/null 2>&1
	@echo 'Done.'
